package com.chinatechstar.component.commons.enums;

import java.util.LinkedHashMap;

/**
 * @createTime: 2023-09-27
 * @creater: yong
 */
public enum Nation {
    /**
     * 类型(描述，编码)
     */
    HAN("汉族", "1"),
    MENGGU("蒙古族", "2"),
    HUI("回族", "3"),
    ZANG("藏族", "4"),
    WEIWUER("维吾尔族", "5"),
    MIAO("苗族", "6"),
    YI("彝族", "7"),
    ZHUANG("壮族", "8"),
    BUYI("布依族", "9"),
    CHAOXIAN("朝鲜族", "10"),
    MAN("满族", "11"),
    DONG("侗族", "12"),
    YAO("瑶族", "13"),
    BAI("白族", "14"),
    TUJIA("土家族", "15"),
    HANI("哈尼族", "16"),
    KAZAK("哈萨克族", "17"),
    DAI("傣族", "18"),
    LI("黎族", "19"),
    LISU("傈僳族", "20"),
    WA("佤族", "21"),
    SHE("畲族", "22"),
    GAOSHAN("高山族", "23"),
    LAHU("拉祜族", "24"),
    SUI("水族", "25"),
    DONGXIANG("东乡族", "26"),
    NAXI("纳西族", "27"),
    JINGPO("景颇族", "28"),
    KEERKEZI("柯尔克孜族", "29"),
    TU("土族", "30"),
    DAHANER("达斡尔族", "31"),
    MULAO("仫佬族", "32"),
    QIANG("羌族", "33"),
    BULANG("布朗族", "34"),
    SALA("撒拉族", "35"),
    MAONAN("毛南族", "36"),
    GELAO("仡佬族", "37"),
    XIBO("锡伯族", "38"),
    ACHANG("阿昌族", "39"),
    PUMI("普米族", "40"),
    TAJIKE("塔吉克族", "41"),
    NU("怒族", "42"),
    WUZIBIEKE("乌孜别克族", "43"),
    ELUOSI("俄罗斯族", "44"),
    EWENKI("鄂温克族", "45"),
    DEANG("德昂族", "46"),
    BONAN("保安族", "47"),
    YUGU("裕固族", "48"),
    JING("京族", "49"),
    TATAER("塔塔尔族", "50"),
    DULONG("独龙族", "51"),
    ELUNCHUN("鄂伦春族", "52"),
    HEZHEN("赫哲族", "53"),
    MONBA("门巴族", "54"),
    LUOBA("珞巴族", "55"),
    JINUO("基诺族", "56");

    public String description;

    public String code;

    Nation(String description, String code) {
        this.description = description;
        this.code = code;
    }

    public static String getDescriptionByCode(String code){
        for (Nation value : Nation.values()) {
            if (value.code.equals(code)){
                return value.description;
            }
        }
        return null;
    }

    public static String getCodeByDescription(String description){
        for (Nation value : Nation.values()) {
            if (value.description.equals(description)){
                return value.code;
            }
        }
        return null;
    }

    public static LinkedHashMap<String,String> getMap(){
        LinkedHashMap<String,String> res = new LinkedHashMap<String,String>();
        for (Nation value : values()) {
            res.put(value.code, value.description);
        }
        return res;
    }
}
